﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Crgd.UAuthServer.T4.Entities
{
	public sealed class EnumValue
	{
		public EnumValue() { }

		public EnumValue(string valueTextInfo)
		{
			if (string.IsNullOrEmpty(valueTextInfo))
			{
				throw new ArgumentNullException("valueTextInfo", $"【{valueTextInfo}】枚举定义文本不能为空！");
			}

			var valueTextInfos = valueTextInfo.Split(new string[] { "," }, StringSplitOptions.None);
			if(valueTextInfos.Length != 3)
			{
				throw new ArgumentNullException("valueTextInfo", $"【{valueTextInfo}】枚举定义文本格式不正确！");
			}

			this.Key = valueTextInfos[2];
			this.Value = valueTextInfos[1];
			this.Description = valueTextInfos[0];
		}

		public string Key { get; set; }

		public string Value { get; set; }

		public string Description { get; set; }

        public override string ToString()
        {
			return $"{Value}-{Description};";
        }
    }
}
